<%--
  Created by IntelliJ IDEA.
  User: 86178
  Date: 2022/4/8
  Time: 20:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/webjars/bootstrap/4.6.1/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/webjars/jquery/3.5.1/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/bootstrap/4.6.1/js/bootstrap.min.js"></script>
    <title>用户信息展示</title>
</head>
<body>

<div class="col-10" style="background-color: #8fc0c0">
    ${pageContext.request.contextPath}
    <form class="table tab-content" action="AddUserInfoServlet" method="post">
        <table class="table table-striped">
            <thead>
            <tr>
                <th scope="col">用户名</th>
                <th scope="col">性别</th>
                <th scope="col">登陆地点</th>
                <th scope="col"></th>
            </tr>
            </thead>
            <tbody>
            <tr class="ui-state-active">
                <td><input type="text" name="userName" id="userName"/></td>
                <td><input type="text" name="userSex" id="userSex"/></td>
                <td><input type="text" name="userAd" id="userAd"/></td>
                <td><input type="submit" value="插入数据到user表"/></td>
            </tr>
            </tbody>
        </table>
    </form>
    <a href="/ShowInfoServlet" class="ui-button">显示多对多数据</a>
    <div style="background-color: darkgray">
        <form action="/ShowInfoServlet" method="post">
            <table class="table table-dark">
                <thead>
                <tr>
                    <th>用户名称</th>
                    <th>用户职位</th>
                    <th>职位描述</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${requestScope.userRole}" var="list">
                    <c:forEach items="${list.users}" var="user">
                        <tr>
                            <td>${user.username}</td>
                            <td>${list.ROLE_NAME}</td>
                            <td>${list.ROLE_DESC}</td>
                        </tr>
                    </c:forEach>
                </c:forEach>
                </tbody>
            </table>
        </form>
    </div>
    <a href="/userInfoServlet" class="ui-button">显示user表的全部信息</a>
    <form id="searchFrom" action="/userInfoServlet" method="post">
        <table class="table table-striped">
            <thead>
            <tr>
                <th>id</th>
                <th>用户名称</th>
                <th>用户最后登陆时间</th>
                <th>用户性别</th>
                <th>用户地点</th>
                <th>修改</th>
                <th>删除</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${msg}" var="list">
                <tr>
                    <td>${list.id}</td>
                    <td>${list.username}</td>
                    <td>${list.birthday}</td>
                    <td>${list.sex}</td>
                    <td>${list.address}</td>
                    <td><a href="/UpdateUserInfoServlet?id=${list.id}" class="ui-button">修改</a>
                    <td><a href="/DeleteUserByIdServlet?id=${list.id}" class="ui-button">删除</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </form>

</div>

</body>
</html>
